package com.ztsoft.user.controller.dynamic;

import com.ztsoft.user.common.base.NewBaseController;
import com.ztsoft.user.pojo.entity.dynamic.QueryInfo;
import com.ztsoft.user.pojo.enums.ResultCode;
import com.ztsoft.user.service.dynamic.QueryInfoService;
import com.ztsoft.user.utils.Result;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/queryInfo")
@RestController
@Api(tags = "查询条件模块")
@CrossOrigin("*")
public class QueryInfoController extends NewBaseController<QueryInfo, String, QueryInfoService> {
    @Override
    public Result save(@RequestBody QueryInfo queryInfo) {
        baseService.saveQueryInfo(queryInfo);
        return Result.success();
    }

    @Override
    public Result<QueryInfo> getById(@PathVariable("id") String id) {
        QueryInfo queryInfo = baseService.getQueryInfoById(id);
        return Result.returnDataMsg(ResultCode.SUCCESS.getMsg(), ResultCode.SUCCESS.getCode(), queryInfo);
    }

    @Override
    public Result delete(@PathVariable("id") String id) {
        baseService.deleteQueryInfo(id);
        return Result.success();
    }
}